package com.koron.ticket.line.work.workticket.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.ticket.line.work.workticket.bean.po.LineTicketOrder;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 线路工作票工单信息(LineTicketOrder)表服务接口
 *
 * @author jzp
 * @since 2023-02-03 10:12:59
 */
public interface LineTicketOrderService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    LineTicketOrder getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param lineTicketOrder 查询条件对象
     * @return 列表结果集
     */
    List<LineTicketOrder> list(SessionFactory factory, LineTicketOrder lineTicketOrder);

    List<LineTicketOrder> listByTicketId(SessionFactory factory, String ticketId);

    /**
     * 分页查询
     * @param lineTicketOrder 分页条件
     * @return 对象列表
     */
    default PageInfo<LineTicketOrder> page(SessionFactory factory, PageQuery pageQuery, LineTicketOrder lineTicketOrder){
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<LineTicketOrder> lineTicketOrderList = list(factory, lineTicketOrder);
        return new PageInfo<>(lineTicketOrderList);
    }

    /**
     * 新增数据
     *
     * @param lineTicketOrder 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, LineTicketOrder lineTicketOrder);

    boolean saveBatch(SessionFactory factory, List<LineTicketOrder> lineTicketOrderList);

    /**
     * 修改数据
     *
     * @param lineTicketOrder 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, LineTicketOrder lineTicketOrder);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(SessionFactory factory, String id);

    boolean removeByTicketId(SessionFactory factory, String ticketId);
}
